package com.kxq.zhuoyue.controller;

import com.kxq.zhuoyue.pageUtilEntity.EmpDept;
import com.kxq.zhuoyue.po.Clients;
import com.kxq.zhuoyue.po.Emp;
import com.kxq.zhuoyue.service.impl.EmpServiceImpl;
import com.kxq.zhuoyue.po.Result;
import com.kxq.zhuoyue.util.result.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/emps")
public class EmpController {

    @Autowired
    private EmpServiceImpl empService;

    @GetMapping("/findEmpName")
    public Result findEmpName() {
        List<Emp> list = empService.findEmpName();
        return Result.success(list);
    }

    @PostMapping("/getList/{EmpId}")
    public AjaxResult getList(@PathVariable String EmpId) {
        List<Emp> list = empService.getUserList(EmpId);
        return AjaxResult.success("联系客户统计", list);
    }

    @PostMapping("/outside/{EmpId}")
    public AjaxResult outside(@PathVariable String EmpId) {
        List<Emp> list = empService.outside(EmpId);
        return AjaxResult.success("外部好友", list);
    }

    @PostMapping("/inside/{EmpId}")
    public AjaxResult inside(@PathVariable String deptId) {
        List<Emp> list = empService.inside(deptId);
        return AjaxResult.success("内部好友", list);
    }

    @PostMapping("/statistics")
    public AjaxResult statistics() {
        List<Emp> list = empService.statistics();
        return AjaxResult.success("练习客户统计", list);
    }

    /**
     * 获取所有job
     *
     * @return
     */
    @GetMapping("/getAllJop")
    public AjaxResult getJop() {
        Map jop = empService.getJop();
        return AjaxResult.success(jop);
    }

    @PostMapping("/getStaffInfo/{empId}")
    public AjaxResult getStaffInfo(@PathVariable String empId) {
        EmpDept byId = empService.getEmpById(empId);
        return AjaxResult.success(byId);
    }
}
